/****************************************************************************
 *   $Id:: ssp_main.c 4785 2010-09-03 22:39:27Z nxp21346                    $
 *   Project: NXP LPC11xx SSP example
 *
 *   Description:
 *     This file contains SSP test modules, main entry, to test SSP APIs.
 *
 ****************************************************************************
 * Software that is described herein is for illustrative purposes only
 * which provides customers with programming information regarding the
 * products. This software is supplied "AS IS" without any warranties.
 * NXP Semiconductors assumes no responsibility or liability for the
 * use of the software, conveys no license or title under any patent,
 * copyright, or mask work right to the product. NXP Semiconductors
 * reserves the right to make changes in the software without
 * notification. NXP Semiconductors also make no representation or
 * warranty that such application will be suitable for the specified
 * use without further testing or modification.
 ****************************************************************************/
#include "driver_config.h"
#include "target_config.h"
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include "gpio.h"
#include "timer322.h"
#include "ssp.h"
#include "RFM70.h"
#if SSP_DEBUG
#include "uart2.h"
#endif

#define SSP_NUM			0

uint8_t src_addr[SSP_BUFSIZE];
uint8_t dest_addr[SSP_BUFSIZE];
u8 rx_buf[MAX_PACKET_LEN];
u8 tmp[100];
int main(void) {
	uint32_t i;
#if SSP_DEBUG
	int8_t temp[2];
#endif

	SystemInit();

#if SSP_DEBUG
	UARTInit(115200);
#endif

	SSP_IOConfig(SSP_NUM); /* initialize SSP port, share pins with SPI1
	 on port2(p2.0-3). */
	SSP_Init(SSP_NUM);

	RFM70_Initialize();
	RFM70_SwitchToRxMode();

	UARTSend("INIT\r\n", 6);
	while (1) {
		Receive_Packet(rx_buf);
		if (rx_buf[0] != 0) {
			UARTSend("PACK\r\n", 6);
		}
	}
	return 0;
}
